<template>
    <div>
        <van-pull-refresh v-model="isRefresh" @refresh="loadAllData" class="wdp-2">
            <!--导航栏-->
            <bpm-nav-bar title="工作台" :leftArrow="false"></bpm-nav-bar>

            <app-list ref="appList" :refresh="isRefresh" @showAppManage="showAppManage"
                      @showAppTaskList="showAppTaskList"></app-list>

            <meeting-list ref="meetingList" :refresh="isRefresh"></meeting-list>

            <task-list ref="taskList" :refresh="isRefresh" @detailFromTask="detailFromTask"></task-list>
        </van-pull-refresh>

        <app-manage ref="appManage" @refresh="loadAppCustom"></app-manage>

        <flow-approve ref="flowApprove" @refresh="loadTaskListAndCount"></flow-approve>
    </div>
</template>

<script>

    import bpmNavBar from '../../components/bpmNavBar';
    import appManage from '../app/appManage';
    import flowApprove from '../bpmTask/flowApprove'
    import taskList from './taskList';
    import meetingList from './meetingList';
    import appList from './appList';

    export default {
        name: 'workbench',
        components: {
            bpmNavBar,
            appManage,
            flowApprove,
            taskList,
            meetingList,
            appList,
        },
        data() {
            return {
                isRefresh: false,
            }
        },
        methods: {
            showAppManage() {
                this.$refs.appManage.show();
            },
            showAppTaskList(appId) {
                this.$router.push("/app/" + appId);
            },
            detailFromTask(taskId) {
                this.$refs.flowApprove.detailFromTask(taskId);
            },
            addFromProcess(processDefId) {
                this.$refs.flowApprove.addFromProcess(processDefId);
            },
            loadAllData() {
                this.isRefresh = false;
                this.$emit("refresh");
            },
            loadTaskListAndCount() {
                this.$refs.taskList.reload();
                this.$emit("refresh");
            },
            loadAppCustom() {
                this.$refs.appList.loadData();
            },
        }
    }
</script>
